<?php defined('SYSPATH') or die('No direct script access.');
$officefunctions = Helper_officefunctions::factory();
$thesystems      = Helper_thesystems::factory();
$display         = Helper_displayitems::factory();
?>

<style type="text/css">
.content {
	width: 100%;
	border: 1px solid black;
	min-height: auto;
}
.contentTop {
	width: 100%;
	border-bottom: 10px solid #DDD;
	height: 100px;
}
.contentTopLeft {
	width: 70%;
	padding-left: 20px;
	padding-top: 5px;
	background-color: #CCCCCC;
	height: 95px;
}
.contentDetail {
	width: 96%;
	margin: 20px;
}
.contentBottom {
	width: 100%;
	border-top: 1px solid black;
}
.left {
	width: 75%;
	float: left;
}
.right {
	width: 25%;
	float: left;
}
.table {
	width: 100%;
	border-collapse: collapse;
}
.small {
	font-size: small;
}
.box1 {
	padding: 10px;
	width: 30%;
	min-height: 100px;
	float: left;
	font-size: small;
	border: 1px solid black;
	border-radius: 5px;
}
.box2 {
	margin-left: 14px;
	margin-bottom: 10px;
	padding: 10px;
	width: 65%;
	min-height: 100px;
	float: left;
	font-size: small;
	border: 1px solid black;
	border-radius: 5px;
}
</style>
<?php $invoices_id = Arr::get($_GET,'invoices_id') ?>
<?php $values = $officefunctions->print_invoices($invoices_id) ?>
<pre><?php //print_r($values) ?></pre>
<div class="content">
	<div class="contentTop">
		<div class="contentTopLeft">
			<h3><?php echo $values[0]['contacts_name'] ?></h3>
			Payment Receipt
		</div>
	</div>
	<div class="contentDetail">
		<div>
			<div class="box1">Terima dari / Received From :</div>
			<div class="box2">
				<table class="small">
					<tr>
						<td width="81%">No Kwitansi / Receipt No.</td>
						<td width="4%">:</td>
						<td>87hk9879</td>
					</tr>
					<tr>
						<td>Tgl Pembayaran / Payment Date No.</td>
						<td>:</td>
						<td>87hk9879</td>
					</tr>
					<tr>
						<td>Nama Kasir / Cashier Name.</td>
						<td>:</td>
						<td>87hk9879</td>
					</tr>
					<tr>
						<td>Nama Galeri / Gallery Name.</td>
						<td>:</td>
						<td>87hk9879</td>
					</tr>
				</table>
			</div>
		</div>
		<div style="clear: both;">
			<table border="1" cellpadding="3" class="table">
				  <tr>
					  <th>Nama Barang</th>
					  <th width="150">Jumlah</th>
					  <th width="130">Harga</th>
					  <th width="150">Discount</th>
					  <th width="130">Sub total</th>
				  </tr>
				<?php if(empty($values)) { ?>
				  <tr valign="middle">
				    <td colspan="3" valign="middle" style="text-align: center;"><strong>There is no data</strong></td>
				  </tr>
				<?php } else { ?>
				<?php $totaljumlah = 0; ?>
				<?php $subtotal = 0; ?>
				<?php $total_subtotal = 0; ?>
				  <?php foreach($values as $value) { ?>

				  <?php 
				  	$items     			= $value['items'];
						$totalitems     = $value['totalitems'];
						$ammounts       = $value['ammounts'];
						$discounts      = $value['discounts'];
						$globaldiscount = $values[0]['globaldiscount'];
						$totaljumlah    += $totalitems;
						$subtotal       = $totalitems * $ammounts - $discounts;
						$total_subtotal += $subtotal;
				  ?>
					<tr>
						<?php $type = $thesystems->system_auth('module_products_detail_type'); ?>
						<?php if($type == 'skus') { ?>
							<?php $table = 'skus'; ?>
							<?php $field = 'value'; ?>
						<?php } else { ?>
							<?php $table = 'ucts'; ?>
							<?php $field = 'name'; ?>
						<?php } ?>
						<td><?php echo $display->show_value($items,'prod'.$table,$field) ?></td>
						<td><?php echo $totalitems ?></td>
						<td><?php echo number_format($ammounts,0) ?></td>
						<td><?php echo number_format($discounts,0) ?></td>
						<td><?php echo number_format($subtotal,0); ?></td>
					</tr>
				  <?php } ?>
				  <tr>
				  	<td style="text-align: right;"></td>
				  	<td><?php echo $totaljumlah; ?></td>
				  	<td colspan="2" style="text-align: right;"><strong>Total : </strong></td>
				  	<td><?php echo number_format($total_subtotal,0) ?></td>
				  </tr>
				  <tr>
				  	<td colspan="4" style="text-align: right;"><strong>Global Discount :</strong></td>
				  	<td><?php echo number_format($globaldiscount,0) ?></td>
				  </tr>
				  <tr>
				  	<td colspan="4" style="text-align: right;"><strong>Grand Total :</strong></td>
				  	<td><?php echo number_format($total_subtotal - $globaldiscount,0) ?></td>
				  </tr>
				<?php } ?>
			</table>
	</div>


	<div style="margin-top: 10px;">
		<div class="left small">
			Customer Care : <?php echo $values[0]['contacts_phone1'] ?> <br>
			Email : <?php echo $values[0]['contacts_email'] ?><br><br>

			*Barang yang sudah diterima tidak dapat dikembalikan / No exchange, no return, no refund for all items sold.<br>
			*Harga sudah termasuk PPN / Prices indicated are inclusive of VAT<br>
			*Bukti Pembayaran ini adalah faktur pajak sederhana / This payment receipt is a simple tax voice.
		</div>
		<div class="right">
			<table border="1" cellpadding="0" class="table small">
				<tr>
					<td colspan="2">

						<table class="table small" style="margin: 5px;">
							<tr>
								<td width="50%">Metode Pembayaran</td>
								<td>:</td>
								<td>100.000</td>
							</tr>
							<tr>
								<td>Tunai</td>
								<td>:</td>
								<td>100.000</td>
							</tr>
							<tr>
								<td>Kartu Kredit</td>
								<td>:</td>
								<td>100.000</td>
							</tr>
						</table>

					</td>
				</tr>
				<tr>
					<td height="70px" valign="top" align="center">Tanda Tangan Pelanggan</td>
					<td valign="top" align="center">Tanda Tangan Kasir</td>
				</tr>
			</table>
		</div>
	</div>
	</div>
	

</div>























